package com.hspedu.newData.dmsxl.数组;

import org.junit.Test;

/**
 * @Author: yh
 * @description: 
 * @CreateTime: 2025-05-10 
 * @Version: 1.0
 */

public class LC1742盒子中小球的最大数量 {

    public int countBalls(int lowLimit, int highLimit) {

        int[] infinity = new int[27];

        for (int i = lowLimit; i <= highLimit; i++) {
            int i1 = f1(i);
            infinity[i1-1]++;
        }
        int max = infinity[0];
        for (int i = 1; i < 27; i++) {
            if (max<infinity[i]){
                max = infinity[i];
            }
        }
        return max;
    }


    public int f1(int i){

        int sum = 0;
        while (i>0){
            sum  += i % 10;
            i /= 10;
        }
        return sum;
    }

    @Test
    public void test() {
        // 测试代码

        int i = countBalls(1780, 3875);
    }
}
